

{include file='common2/header.html'}
<!-- 内容主体区域 -->
<div class="layui-body">
  <!--        <div style="padding: 15px;"><h1 style="font-weight: 700">欢迎界面</h1></div>-->
  <div id="user_container" style="padding: 15px;">
    <!--            面包屑导航-->
    <span class="layui-breadcrumb">
              <a href="#" style="font-weight: 700;color: #000!important;">首页</a>
              <a href="#" style="font-weight: 700;color: #000!important;">图书展示</a>
              <a href="" >图书列表</a>
            </span>
    <div class="layui-row layui-col-space15" style="margin-top: 15px">
      <div class="layui-col-md12">
        <div class="layui-panel" style="padding: 20px">
          <div class="layui-form-item">
            <form class="layui-form" action="">
              <div class="layui-form-item">
                <label class="layui-form-label">原密码</label>
                <div class="layui-input-block">
                  <input type="text" name="oldPwd" required  lay-verify="required" placeholder="请输入原密码" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">新密码</label>
                <div class="layui-input-block">
                  <input type="password" name="newPwd" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item" style="margin-left: 20px">
                <div class="layui-input-block">
                  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</div>







<script>
  document.querySelector('.layui-nav-itemed').classList.remove('layui-nav-itemed');
  $('a[href$=personal]').parent()[0].classList.add('layui-this');
  $('a[href$=personal]').parent().parent().parent()[0].classList.add('layui-nav-itemed');

  layui.use('form', function(){
    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)',  function(data){
       // layer.msg(data.field.oldPwd);
        $.post('/home/personal/update',{
          old:data.field.oldPwd,
          new:data.field.newPwd
        },function (d) {
         if(d.state!=200){
            return layer.msg(d.message, {
             icon: 0,
             time: 1000
           })
         }
          layer.msg('修改成功请重新登录', {
            icon: 1,
            time: 1000
          },function() {
            window.location.href = '/signOut'
          })

        })
      return false;
    });
  });

</script>


{include file='common2/footer.html'}
